package com.hyq.market.ui.home.shopcar;

import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.hyq.market.adapter.HotGoodsAdapter;
import com.hyq.market.adapter.IndexClassAdapter;
import com.hyq.market.api.BaseRequest;
import com.hyq.market.base.IMode;
import com.hyq.market.bean.ClassIndex;
import com.hyq.market.bean.Goods;
import com.hyq.market.ui.goodsDetail.GoodsDetail;
import com.hyq.market.ui.home.PersenterAdapterListener;
import com.hyq.market.ui.home.home.IViewHome;
import com.hyq.market.ui.home.model.IndexUtil;
import com.hyq.market.ui.home.model.ModelGoods;
import com.hyq.market.ui.search.SearchAct;

/**
 * Created by Administrator on 2017/7/19 0019.
 */

public class PersenterShopCar extends PersenterAdapterListener<IViewShopCar> {
    private IViewShopCar iView;
    private IMode iMode;
    private boolean pullMore;
    private int totalPages;
    private int nowPage=1;
    private int totalPagesGoods;

    public PersenterShopCar(IViewShopCar iView) {
        this.iView=iView;
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
       onItemChildClick(adapter,view,position);
    }

    @Override
    public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
        if (adapter instanceof IndexClassAdapter){
            doSubClassClick(adapter,view,position);
        }
        if (adapter instanceof HotGoodsAdapter)
        {
            doGoodsClick(adapter,view,position);
        }
    }

    private  void doGoodsClick(BaseQuickAdapter adapter, View view, int position){
        Goods.DataBean bean= (Goods.DataBean) adapter.getData().get(position);
        Bundle b=new Bundle();
        b.putString("id",bean.getId());
        iView.startActivity(GoodsDetail.class,b,0x234);
        bean=null;


    }

    private  void doSubClassClick(BaseQuickAdapter adapter, View view, int position){
        iView.startActivity(SearchAct.class);
    }

    @Override
    public <T> void getData(T t) {

    }
}
